<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>  
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js" ></script>  
<style>

#featured{  
     width:400px;  
     padding-right:250px;  
     position:relative;  
     height:250px;  
     background:#fff;  
     border:5px solid #ccc;  
 }
#featured ul.ui-tabs-nav{
	position:absolute;
	top:0; left:400px;
	list-style:none;
	padding:0; margin:0;
	width:250px;
}
#featured ul.ui-tabs-nav li{
	padding:1px 0; padding-left:13px;
	font-size:12px;
	color:#666;
}
#featured ul.ui-tabs-nav li span{
	font-size:11px; font-family:Verdana;
	line-height:18px;
}

#featured .ui-tabs-panel{
	width:400px; height:250px;
	background:#999; position:relative;
        overflow:hidden;
}
#featured .ui-tabs-hide{
	display:none;
}


#featured li.ui-tabs-nav-item a{/*On Hover Style*/
	display:block;
	height:60px;
	color:#333;  background:#fff;
	line-height:20px;
	outline:none;
}
#featured li.ui-tabs-nav-item a:hover{
	background:#f2f2f2;
}
#featured li.ui-tabs-selected{ /*Selected tab style*/
	background:url('images/selected-item.gif') top left no-repeat;
}
#featured ul.ui-tabs-nav li.ui-tabs-selected a{
	background:#ccc;
}

#featured ul.ui-tabs-nav li img{
	float:left; margin:2px 5px;
	background:#fff;
	padding:2px;
	border:1px solid #eee;
}


#featured .ui-tabs-panel .info{
	position:absolute;
	top:180px; left:0;
	height:70px; width: 400px;
	background: url('images/transparent-bg.png');
}
#featured .info h2{
	font-size:18px; font-family:Georgia, serif;
	color:#fff; padding:5px; margin:0;
	overflow:hidden;
}
#featured .info p{
	margin:0 5px;
	font-family:Verdana; font-size:11px;
	line-height:15px; color:#f0f0f0;
}
#featured .info a{
	text-decoration:none;
	color:#fff;
}
#featured .info a:hover{
	text-decoration:underline;
}
 
</style>

<script>
 $(document).ready(function(){  
	 $("#featured").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, true);  
	 $("#featured").hover(  
		function() {  
	 		$("#featured").tabs("rotate",0,true);  
	 	},  
	 	function() {  
	 	$("#featured").tabs("rotate",5000,true);  
	 });  
});

</script>

    <?php
    // set feed URL
    $feedURL = 'http://gdata.youtube.com/feeds/api/users/tvpapao/uploads';
    
    // read feed into SimpleXML object
    $sxml = simplexml_load_file($feedURL);
//    echo "<PRE>";
//    print_r($sxml);
//    echo "<PRE>";
    ?>
      <h1><?php echo $sxml->title; ?></h1>
      
      
   <div id="featured" >  
       <ul class="ui-tabs-nav">        
    <?php
    $w = 1;
    // iterate over entries in feed
    foreach ($sxml->entry as $entry) {
      // get nodes in media: namespace for media information
      $media = $entry->children('http://search.yahoo.com/mrss/');
      
      // get video player URL
      $attrs = $media->group->player->attributes();
      $watch = $attrs['url']; 
      
      // get video thumbnail
      $attrs = $media->group->thumbnail[0]->attributes();
      $thumbnail = $attrs['url']; 
            
      // get <yt:duration> node for video length
      $yt = $media->children('http://gdata.youtube.com/schemas/2007');
      $attrs = $yt->duration->attributes();
      $length = $attrs['seconds']; 

      // get <gd:rating> node for video ratings
      $gd = $entry->children('http://schemas.google.com/g/2005'); 
      if ($gd->rating) {
        $attrs = $gd->rating->attributes();
        $rating = $attrs['average']; 
      } else {
        $rating = 0; 
      } 
	      if ($w==1)
	      {
	      	$w++;
	      ?>
	            <li class="ui-tabs-nav-item ui-tabs-selected" id="nav-fragment-<?php print($w); ?>">
	            	<a href="#fragment-<?php print($w); ?>">
	           			<img width="50px" src="<?php echo $thumbnail;?>" alt="<?php echo $media->group->description; ?>" />
	           			<span><?php echo $media->group->description; ?></span>
	           		</a>
	            </li>  
		<?php
	      }else
	      {
	      	
	      	?>
	           	<li class="ui-tabs-nav-item" id="nav-fragment-<?php print($w); ?>">
	           		<a href="#fragment-<?php print($w); ?>">
	           			<img width="50px" src="<?php echo $thumbnail;?>" alt="" />
	           			<span><?php echo $media->group->description; ?></span>
	           		</a>
	           	</li>      	
	     	<?php
	     	$w++; 
	      }
     }?>             
     
     </ul>
     
    <?php
    $w = 1;
    // iterate over entries in feed
    foreach ($sxml->entry as $entry) {
      // get nodes in media: namespace for media information
      $media = $entry->children('http://search.yahoo.com/mrss/');
      
      // get video player URL
      $attrs = $media->group->player->attributes();
      $watch = $attrs['url']; 
      
      // get video thumbnail
      $attrs = $media->group->thumbnail[0]->attributes();
      $thumbnail = $attrs['url']; 
            
      // get <yt:duration> node for video length
      $yt = $media->children('http://gdata.youtube.com/schemas/2007');
      $attrs = $yt->duration->attributes();
      $length = $attrs['seconds']; 

      // get <gd:rating> node for video ratings
      $gd = $entry->children('http://schemas.google.com/g/2005'); 
      if ($gd->rating) {
        $attrs = $gd->rating->attributes();
        $rating = $attrs['average']; 
      } else {
        $rating = 0; 
      } 
	      if ($w==1)
	      {
	      	$w++;
	      ?>
	       <!-- First Content -->  
	       <div id='fragment-<?php print($w); ?>' class="ui-tabs-panel" style="">  
	           <img width="400px" height="250px" src="<?php echo $thumbnail;?>" alt="" />  
	           <div class="info" >  
	           <h2><a href="#" >Duration: <?php printf('%0.2f', $length/60); ?> min.</a></h2>  
	           <p><?php echo $media->group->description; ?><a href="<?php echo $watch; ?>" >read more</a></p>  
	           </div>  
	       </div>  
		<?php
	      }else
	      {
	      	
	      	?>
	       <!-- Second Content -->  
	       <div id="fragment-<?php print($w); ?>" class="ui-tabs-panel ui-tabs-hide" style="">  
	           <img width="400px" height="250px" src="<?php echo $thumbnail;?>" alt="" />  
	           <div class="info" >  
	           <h2><a href="#" >Duration: <?php printf('%0.2f', $length/60); ?> min.</a></h2>  
	           <p><?php echo $media->group->description; ?><a href="<?php echo $watch; ?>" >Assista no youtube.</a></p>  
	           </div>  
	       </div>        	
	     	<?php 
	     	$w++;
	      }
     }?>       
   </div>  
<!--
      <div class="item">
        <h2 class="title">
          <a href="<?php echo $watch; ?>"><?php echo $media->group->title; ?></a>
        </h2>
        <p><?php echo $media->group->description; ?></p>
        <p>
          <span class="thumbnail">
            <a href="<?php echo $watch; ?>">
            	<img src="<?php echo $thumbnail;?>" />
            </a>
          </span>
          <br />
          <span class="attr">By:</span> <?php echo $entry->author->name; ?> <br/>
          <span class="attr">Duration:</span> <?php printf('%0.2f', $length/60); ?> min. <br/>
           <span class="attr">Views:</span> <?php echo $viewCount; ?> <br/>
          <span class="attr">Rating:</span> <?php echo $rating; ?> 
        </p>
      </div>      
-->
